<?php
/**
 * Created by PhpStorm.
 * User: DELL-PC
 * Date: 2018/7/29
 * Time: 16:40
 */

use J\Schema\Syntax;

return [
    // 模型实体配置信息
    Syntax::KEY_COLLECTIONS => [
        //
        'qzqd' => [
            Syntax::KEY_ELEMENTS => [
                'mainT' => [
                    'type'   => Syntax::VALUE_STRING,
                    'label'  => '项目',
                    'width' => 300,
                ],
                'subT' => [
                    'type'   => Syntax::VALUE_STRING,
                    'label'   => '子项',
                    'width' => 300,
                ],
                'msk' => [
                    'type'   => Syntax::VALUE_STRING,
                    'label'   => '编码',
                    'width' => 200,
                ],
                'pe' => [
                    'type'   => Syntax::VALUE_TEXT,
                    'label'   => '职权依据',
                ],
                'zr' => [
                    'type'   => Syntax::VALUE_TEXT,
                    'label'   => '责任事项',
                ],
                'ze' => [
                    'type'   => Syntax::VALUE_TEXT,
                    'label'   => '责任依据',
                ],
                'zz' => [
                    'type'   => Syntax::VALUE_TEXT,
                    'label'   => '问责依据',
                ],
                'cls' => [
                    'base' => 'select',
                    'label'  => '类型',
                    'width' => 100,
                    'options' => array(
                        1 => '行政许可', '行政处罚', '行政强制', '行政征收', '行政给付',
                        '行政检查','行政确认','行政奖励','行政裁决','其他类'
                    ),
                ],
                'office' => [
                    'type' => Syntax::FIELD_BLS,
                    'width' => 200,
                    'label' => '单位',
                    'column' => 'department'
                ]
            ],
            #  实体标签
            'label' => '清单',
            #  实体默认显示域（比如文章实体默认显示 ）
            'key' => 'msk',
        ],
        //
        'office' => [
            Syntax::KEY_ELEMENTS => [
                'name' => [
                    'type'   => Syntax::VALUE_STRING,
                    'width' => 200,
                    'label' => '名称',
                ]
            ],
            #  实体标签
            'label' => '单位',
            #  实体默认显示域（比如文章实体默认显示 ）
            'key' => 'name',
        ]
    ],
    // 控制器配置信息
    Syntax::KEY_CONTROLLERS => [
        'qzqd' => [
            'title' => '权责管理',
            Syntax::KEY_OPTIONS => [
                'index' => [
                    'view' => Syntax::DISPLAY_TABLE,
                    Syntax::KEY_ELEMENTS => ['msk', 'mainT', 'subT', 'cls', 'office'],
                    'search' => [
                        Syntax::KEY_ELEMENTS => ['cls']
                    ],
                    'btns' => [
                        'items' => [
                            'add' => [],
                            'deleteSelected' => [],
                            'office' => [
                                'next' => '/element.php/qzqd/office/index'
                            ]
                        ]
                    ],
                    'actions' => [
                        'items' => [
                            'edit' => [],
                            'delete' => [],
                        ],
                    ],
                ],
                'add' => [
                    'view' => Syntax::DISPLAY_FORM,
                    // 'columns' => ['name', 'nickname', 'password'],
                ],
                'edit' => [
                    'view' => Syntax::DISPLAY_FORM,
                    'row' => true,
                ],
                'delete' => [],
                'office' => [
                    'view' => Syntax::DISPLAY_TABLE,
                    Syntax::KEY_ELEMENTS => ['msk', 'mainT', 'subT', 'cls', 'office'],
                    'search' => [
                        Syntax::KEY_ELEMENTS => ['cls']
                    ],
                    // 构建dataUrl
                    Syntax::KEY_QUERY => 'office',
                    // for Data
                    Syntax::KEY_WHERE => ['office'],
                    'btns' => [
                        'items' => [
                            'add' => [],
                            'deleteSelected' => [],
                            'office' => [
                                'next' => '/element.php/qzqd/office/index'
                            ]
                        ]
                    ],
                    'actions' => [
                        'items' => [
                            'edit' => [],
                            'delete' => [],
                        ],
                    ],

                    'param' => ['office'],
                ],
            ]
        ],
        'office' => [
            'title' => '单位管理',
            Syntax::KEY_OPTIONS => [
                'index' => [
                    'view' => Syntax::DISPLAY_TABLE,
                    Syntax::KEY_ELEMENTS => ['name'],
                    'btns' => [
                        'items' => ['add' => [], 'deleteSelected' => []]
                    ],
                    'actions' => [
                        'items' => [
                            'edit' => [],
                            'delete' => [],
                            'power' => [
                                'label' => '权责',
                                'next' => '/element.php/qzqd/qzqd/office',
                            ],
                        ],
                    ],
                ],
                'add' => [
                    'view' => Syntax::DISPLAY_FORM,
                    Syntax::KEY_ELEMENTS => ['name'],
                ],
                'edit' => [
                    'view' => Syntax::DISPLAY_FORM,
                    'row' => true,
                    'where' => [Syntax::KEY_ID],
                    Syntax::KEY_ELEMENTS => ['name']
                ],
                'delete' => [],
            ]
        ],
    ],
    // 安装信息
    Syntax::KEY_INSTALL => [
        Syntax::KEY_RESOURCE => [
            [
                'title' => '政府权责',
                'resource' => 0,
                'tip' => '政府权责信息',
                'status' => 1
            ],
            [
                'title' => '权责管理',
                'resource' => 1,
                'url' => '/Qzqd/Qzqd/Index',
                'tip' => '权责信息管理',
                'status' => 1
            ],
        ]
    ]
];

